Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Convert slices to arrays instead of copy where possible #595

Merged
merged 4 commits into from
Jul 9, 2024

Conversation

cthulhu-rider
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

Attention: Patch coverage is 72.97297% with 10 lines in your changes missing coverage. Please review.

Project coverage is 39.47%. Comparing base (4a0be23) to head (d5a5fbc).
Report is 11 commits behind head on master.

Files Patch % Lines
eacl/table.go 81.81% 1 Missing and 3 partials ⚠️
client/container.go 25.00% 2 Missing and 1 partial ⚠️
bearer/bearer.go 0.00% 1 Missing and 1 partial ⚠️
container/id/id.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #595      +/-   ##
==========================================
- Coverage   39.47%   39.47%   -0.01%     
==========================================
  Files         150      147       -3     
  Lines       17594    17494     -100     
==========================================
- Hits         6946     6906      -40     
+ Misses      10269    10213      -56     
+ Partials      379      375       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@carpawell carpawell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked if it is possible to stop our nodes with this SDK version via some bad request? If no, is it a piece of luck or we have good validation checks in all the cases I threaded?

eacl/table.go Outdated Show resolved Hide resolved
object/id/id.go Outdated Show resolved Hide resolved
object/id/id.go Outdated Show resolved Hide resolved
Previously, `Unmarshal`/`UnmarshalJSON` methods accepted any ID length:
 - those that were shorter were padded with zeros;
 - those that were longer were cut off.

This behavior is not declared in the protocol, thus it was incorrect and
could cover potential client/transport bugs. Now the length is strictly
checked. In particular, corresponding unit test now passes.

Signed-off-by: Leonard Lyubich <[email protected]>
`NewTableFromV2` function does not check the length accepts any
container ID length:
- those that were shorter were padded with zeros;
- those that were longer were cut off.

This behavior is incorrect because it goes against the NeoFS API
protocol. However, it is not possible to fix the function backwards
compatible since it does not return an error.

Thus, a new `ReadFromV2` method is added (it is already widely used in
the library). The method checks container ID format and returns an error.
Consequently, now the eACL format is also correctly checked when
decoding a bearer token and `ContainerService.GetExtendedACLResponse`
protocol message by the API client.

`NewTableFromV2` is marked buggy and deprecated, it's going to be purged
for release later.

Signed-off-by: Leonard Lyubich <[email protected]>
Became possible with Go 1.20.

Signed-off-by: Leonard Lyubich <[email protected]>
@carpawell carpawell merged commit 1478127 into master Jul 9, 2024
11 of 12 checks passed
@carpawell carpawell deleted the array-cp branch July 9, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants